package com.wlc.base.lambda;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description
 * @date 2021-07-13 19:38
 */
public class Hero implements Comparable<Hero> {
    /**
     * 姓名
     */
    private String name;
    /**
     * 血量
     */
    private int hp;
    /**
     * 伤害
     */
    private int damage;

    @Override
    public String toString() {
        return "Hero{" +
                "name='" + name + '\'' +
                ", hp=" + hp +
                ", damage=" + damage +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getHp() {
        return hp;
    }

    public void setHp(int hp) {
        this.hp = hp;
    }

    public int getDamage() {
        return damage;
    }

    public void setDamage(int damage) {
        this.damage = damage;
    }

    public Hero() {
    }

    public Hero(String name, int hp, int damage) {
        this.name = name;
        this.hp = hp;
        this.damage = damage;
    }

    @Override
    public int compareTo(Hero anotherHero) {
        return damage - anotherHero.damage > 0 ? 1 : -1;
    }

    public boolean match(Hero hero) {
        return hero.getHp() > 100 && hero.getDamage() < 50;
    }

    public static boolean match2(Hero hero) {
        return hero.getHp() > 100 && hero.getDamage() < 50;
    }
}
